import { execa } from 'execa';

const cloneProject = () => {
    return new Promise((resolve, reject) => {
        console.log('%c%s', 'color: blue', 'start clone...');
        execa(`git`, ['clone', 'https://codeup.aliyun.com/motigo/huodian/web.git'], { cwd: './' })
            .then(res => {
                // let res = {
                //     command: 'git clone https://codeup.aliyun.com/motigo/huodian/web.git',
                //     escapedCommand: 'git clone "https://codeup.aliyun.com/motigo/huodian/web.git"',
                //     exitCode: 0,
                //     stdout: '',
                //     stderr: "Cloning into 'web'...",
                //     all: undefined,
                //     failed: false,
                //     timedOut: false,
                //     isCanceled: false,
                //     killed: false
                // };
                console.log('%c%s', 'color: blue', `clone success...\n ${res}`);
                resolve(res);
            })
            .catch(err => {
                reject(err);
            });
    });
};

module.exports = {
    cloneProject,
};
